﻿@model NewsItemModel
@using Nop.Web.Framework.UI.Captcha;
@using Nop.Web.Models.News;
@{
    Layout = "~/Views/Shared/_Root.cshtml";

    //title
    Html.AddTitleParts(Model.Title);
}
<div class="newsitem">
    <div class="page-title">
        <h1>@Model.Title</h1>
    </div>
    <div class="clear">
    </div>
    <div class="newsdate">
        @Model.CreatedOn.ToString("D")
    </div>
    @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "mobile_newsitem_page_before_body" })
    <div class="newsbody">
        @Html.Raw(Model.Full)
    </div>
    @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "mobile_newsitem_page_before_comments" })
    @if (Model.AllowComments)
    {
        <div class="newscomments">
            <div class="title">
                @T("News.Comments")
            </div>
            <div class="clear">
            </div>
            <div class="newcomment">
                @using (Html.BeginForm())
                {
                    <div class="leavetitle">
                        <strong>
                            @T("News.Comments.LeaveYourComment")
                        </strong>
                    </div>
                    <div>
                        @Html.LabelFor(model => model.AddNewComment.CommentTitle)
                        @Html.TextBoxFor(model => model.AddNewComment.CommentTitle, new { @class = "commenttitle" })
                        @Html.ValidationMessageFor(model => model.AddNewComment.CommentTitle)
                    </div>
                    <div>
                        @Html.LabelFor(model => model.AddNewComment.CommentText)
                        @Html.TextAreaFor(model => model.AddNewComment.CommentText, new { @class = "commenttext" })
                        @Html.ValidationMessageFor(model => model.AddNewComment.CommentText)
                    </div>
                    string result = TempData["nop.news.addcomment.result"] as string;
                    if (!String.IsNullOrEmpty(result))
                    {
                    <div class="result">
                        @result
                    </div>
                    }
                    <div class="message-error">
                        @Html.ValidationSummary(true)
                    </div>
                    if (Model.AddNewComment.DisplayCaptcha)
                    {
                        <div class="captcha-box">
                            @Html.Raw(Html.GenerateCaptcha())
                        </div>
                    }
                    <div class="buttons">
                        <input type="submit" id="add-comment" name="add-comment" value="@T("News.Comments.SubmitButton")" />
                    </div>
                       
                }
            </div>
            <div class="clear">
            </div>
            <div class="commentlist">
                @if (Model.Comments.Count > 0)
                {
                    <ul data-role="listview" data-inset="true" data-filter="false">
                        @foreach (var comment in Model.Comments)
                        {
                            <li>
                                <div class="newscomment">
                                    <div class="commentinfo">
                                        <div class="userinfo">
                                            @if (comment.AllowViewingProfiles)
                                            {
                                                <a href="@Url.RouteUrl("CustomerProfile", new { id = comment.CustomerId })" class="username">@(comment.CustomerName)</a>
                                            }
                                            else
                                            {
                                                <span class="username">@(comment.CustomerName)</span>
                                            }
                                        </div>
                                        <div class="commenttime">
                                            @T("News.Comments.CreatedOn"): <span class="statvalue">@comment.CreatedOn.ToString("g")</span>
                                        </div>
                                    </div>
                                    <div class="commentcontent">
                                        <div class="commenttitle">
                                            <span class="commenttext">@comment.CommentTitle</span>
                                        </div>
                                        <div class="commentbody">
                                            <span class="commenttext">@Html.Raw(Nop.Core.Html.HtmlHelper.FormatText(comment.CommentText, false, true, false, false, false, false))</span>
                                        </div>
                                    </div>
                                    @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "mobile_newsitem_page_inside_comment" })
                                </div>
                            </li>
                        }
                    </ul>
                }
            </div>
        </div>
    }
    @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "mobile_newsitem_page_after_comments" })
</div>
